package com.kgc.scd.controller;

import com.kgc.scd.bean.ShopCategories;
import com.kgc.scd.bean.ShopCategory;
import com.kgc.scd.service.CategoriesInfoService;
import com.kgc.scd.service.GoodsInfoCommentService;
import com.kgc.scd.util.RequestResult;
import com.kgc.scd.util.ResultBuildUtil;
import com.kgc.scd.vo.ShopCarouselVO;
import com.kgc.scd.vo.ShopCategoriesVO;
import com.kgc.scd.vo.ShopCategoryVO;
import com.kgc.scd.vo.ShopGoodsVO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created On : 2022/11/16.
 * <p>
 * Author : 22166
 * <p>
 * Description: CategoriesInfoController
 */
@Slf4j
@RestController
public class CategoriesInfoController {

    @Autowired
    private CategoriesInfoService categoriesInfoService;

    @Autowired(required = false)
    private GoodsInfoCommentService goodsInfoCommentService;


    /**
     * @author : 22166
     * @date   : 2022/11/17
     * @param  : [userId]
     * @return : int
     * @description : getShopCartTotal
     */
    @GetMapping({"/getShopCartTotal"})
    public int getShopCartTotal(@RequestParam String userId){

        return categoriesInfoService.getShopCartTotal(userId);

    }


    /**
     * @author : 22166
     * @date   : 2022/11/16
     * @param  : []
     * @return : java.util.List<com.kgc.scd.bean.ShopCategories>
     * @description : 查询商品总分类
     */
   /* @GetMapping("/shopCategoriesList")
    @ApiOperation(value = "查询商品总分类",notes = "获取首页轮播图")
    public RequestResult<?> shopCategoriesList(@RequestParam(required = false) Integer sumCategory){

        if (sumCategory !=null){
            return ResultBuildUtil.success(categoriesInfoService.categoryList(sumCategory));
        }

        return ResultBuildUtil.success(categoriesInfoService.categoriesList(sumCategory));
    }
*/
    @GetMapping("/shopCategoriesVOList")
    public List<ShopCategoriesVO> shopCategoriesVOList(Integer sumCategory){
        return categoriesInfoService.categoriesList(sumCategory);
    }

    /**
     * @author : 22166
     * @date   : 2022/11/16
     * @param  : [sumCategory]
     * @return : java.util.List<com.kgc.scd.bean.ShopCategory>
     * @description : 在shop_category表,根据sum_category查询商品分类列表
     */
    @GetMapping("/shopCategoryList")
    public List<ShopCategoryVO> shopCategoryList(Integer sumCategory){

        return categoriesInfoService.categoryList(sumCategory);
    }


    /**
     * @author : 22166
     * @date   : 2022/11/16
     * @param  : [category_id]
     * @return : java.util.List<com.kgc.scd.vo.ShopGoodsVO>
     * @description : shopGoodsVOList
     */
    @GetMapping("/shopGoodsVOList")
    public List<ShopGoodsVO> shopGoodsVOList(@RequestParam String categoryId){
        return categoriesInfoService.shopGoodsVO(categoryId);
    }





}